<?php
$conn_args = array('host' => 'localhost', 'port' => '5672', 'login' => 'guest', 'password' => 'guest');
$config = [
	'exchangeName' => 'wangjh',
	'routeName' => 'key-route1',
];

$conn = new AMQPConnection($conn_args);
$connect = $conn->connect();
if (!$connect) {
	die('Cannot connect to the broker');
}
echo "Producer is doing its work<br>";
$channel = new AMQPChannel($conn);
$ex = new AMQPExchange($channel);
$ex->setName($config['exchange_name']);
for ($i = 0; $i < 5; $i++) {
	$msg = "wangjh" . $i;
	$ex->publish($msg, $config['routeName']);
}

